import pytest

from api.ihrm_api import IhrmApi
from common.header_util import HeaderUtil
from common.ihrm_assert import Ihrmcommon
from common.read_data import read_ihrmUpdate


class TestIhrmSearch:
    # 定义类属性
    header = None

    # 定义请求头
    @classmethod
    def setup_class(cls):
        cls.header = HeaderUtil.loginApi()

    @pytest.mark.parametrize("emp_id, username, state_code, success, code, message", read_ihrmUpdate())
    def test(self, emp_id, username, state_code, success, code, message):
        data = {"emp_id": emp_id}
        search_result = IhrmApi.update(emp_id, self.header, data)
        # print(search_result.json())
        Ihrmcommon.uid_assert(search_result, state_code, success, code, message)
